<?php

namespace app\admin\model;

use think\Model;


class AccountsReceivable extends Model
{

    

    

    // 表名
    protected $name = 'accounts_receivable';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'settlement_status_text',
        'sales_shipment_id'
    ];

    protected $type = [
        'received_amount' => 'float',
        'paid_amount' => 'float'
    ];

    public function getSettlementStatusList()
    {
        return ['已结清' => __('已结清'), '未结清' => __('未结清'), '剩余未结清' => __('剩余未结清')];
    }

    public function getSettlementStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['settlement_status']) ? $data['settlement_status'] : '');
        $list = $this->getSettlementStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }
    

    







}
